Import cal3d

Class CalCoreMaterial

	Field m_ambientColor:CalColor
	Field m_diffuseColor:CalColor
	Field m_specularColor:CalColor
	Field m_shininess:Float
	Field m_vectorMap:CalMap[]
	Field m_userData:Object
	Field m_name:String
	Field m_filename:String
	
	
	Method New()
	
		m_ambientColor = New CalColor
		m_diffuseColor = New CalColor
		m_specularColor = New CalColor
		m_vectorMap = New CalMap[0]
	End

	Method getAmbientColor:CalColor()
		Return m_ambientColor
	End
	
	Method getDiffuseColor:CalColor()
		Return m_diffuseColor
	End
	
	Method getMapCount:Int()
		Return m_vectorMap.Length
	End
	
	Method getMapFilename:String(mapId:Int)
		If mapId < 0 or mapId >= m_vectorMap.Length then
			Return ""
		Endif
	
		Local map:CalMap = m_vectorMap[mapId]
		If map = Null then
			Return ""
		else
			Return map.filename		
		Endif
	End

	Method getMapUserData:Object(mapId:Int)
		If mapId < 0 or mapId >= m_vectorMap.length then
			Return null
		Endif
	
		Local map:CalMap = m_vectorMap[mapId]
		If map = Null then
			Return null
		else
			Return map.userData	
		Endif			
	End
	
	Method getShininess:Float()
		Return m_shininess
	End
	
	Method getSpecularColor:CalColor()
		Return m_specularColor
	End
	
	Method getUserData:Object()
		Return m_userData
	End

	Method getVectorMap:CalMap[]()
		Return m_vectorMap
	End

	Method getFilename:String()
		Return m_filename
	End

	Method getName:String()
		Return m_name
	End
	
	Method reserve:Bool(mapCount:Int)
		m_vectorMap = New CalMap[mapCount]
		Return True
	End

	Method setAmbientColor:Void(ambientColor:CalColor)
		m_ambientColor = New CalColor(ambientColor)
	End
	
	Method setDiffuseColor:Void(diffuseColor:CalColor)
		m_diffuseColor = New CalColor(diffuseColor)
	End
	
	Method setMap:Bool(mapId:Int, map:CalMap)
		If mapId < 0 Or mapId >= m_vectorMap.Length Then
			Return False
		Endif
	
		m_vectorMap[mapId] = map
		return true	
	
	End
	
	Method setMapUserData:Bool(mapId:Int, userData:Object)
		If mapId < 0 or mapId >= m_vectorMap.length then
			Return False
		Endif
	
		Local map:CalMap = m_vectorMap[mapId]
		If map = Null then
			Return false
		Endif
		
		map.userData = userData		
		Return True
	End

	Method setShininess:Void(shininess:Float)
		m_shininess = shininess
	End
	
	Method setSpecularColor:Void(specularColor:CalColor)
		m_specularColor = New CalColor(specularColor)
	End
	
	Method setFilename:Void(filename:String)
		m_filename = filename
	End
	
	
	Method setName:Void(name:String)
		m_name = name
	End
	
	
	Method setUserData:Void(userData:Object)
		m_userData = userData
	End

End Class

Class CalColor

	Field red:Float,green:Float,blue:Float,alpha:Float

	Method New()
		red = 0
		green = 0
		blue = 0
		alpha = 0
	End
	
	Method New(c:CalColor)
	
		red = c.red
		green = c.green
		blue = c.blue
		alpha = c.alpha
	
	End
	
	Method New(r:Float,g:Float,b:Float,a:Float)
	
		red = r
		green = g
		blue = b
		alpha = a
		
	End
	

End Class

Class CalMap

	Field filename:String
	Field userData:Object
	
	

End Class